import regeneratorRuntime from '../../plugins/regenerator-runtime.js'
import { addVisitorFrequency } from '../../utils/encapsulation.js'//数据监控
import { Request_API_CN, Request_API_COM } from '../../utils/index.js'//封装请求
import login from '../../api/login.js'
import { prefix, surface } from '../../api/config.js';
const app = getApp()
let _this
Page({
  data: {
    Active: '1',//选中
    data:[],
    oneNub:'',//一级人数
    twoNub:'',//二级人数
    threeNub:'',//三级人数
  },
  onLoad: function () {
    _this = this;
    _this.myteam();
    wx.showLoading({
      mask: true,
    })
  },
  distTab: (e) => {//tab点击
    console.log(e.currentTarget.dataset.id)
    if (_this.data.Active != e.currentTarget.dataset.id) {
      _this.setData({ Active: e.currentTarget.dataset.id })
    }
  },
  myteam:()=>{//我的团队
    Request_API_CN(prefix+'/myteam', 'POST', { openid: app.globalData.openid })
    // Request_API_CN('/lipstick/myteam', 'POST', { openid: 'o1IkB5aOgM9N38cZhvnpz52gehus' })
      .then((res) => {
        console.log(res.data.data)
        _this.setData({
          data:res.data.data,
          firstAgent: res.data.data.firstAgent,
          oneNub: res.data.data.firstAgent.length,
          twoNub: res.data.data.secondAgent.length,
          threeNub: res.data.data.thirdAgent.length,
        })
        wx.hideLoading()
      })
  }
})